home *** CD-ROM | disk | FTP | other *** search
/ How to Get Online 1996 Spring / HOW2GON.ISO / mac / E-Mail / Auto-send to address / somename@somedomain (text) < prev   
Encoding:
Text File  |  1994-06-15  |  1.6 KB  |  49 lines  |  [TEXT/ToyS]

  1. -- This is a very useful function that returns the name of a file, 
  2. -- given its full path name
  3. -- Feel free to use it in your own scripts!
  4.  
  5. on FindName(fullPathName)
  6.     if {string} does not contain class of fullPathName then
  7.         set fullPathName to (fullPathName as string)
  8.     end if
  9.     try
  10.         set oldDelimiters to (AppleScript's text item delimiters)
  11.         set AppleScript's text item delimiters to {":"}
  12.         set theName to (last text item of fullPathName)
  13.         set AppleScript's text item delimiters to oldDelimiters
  14.     on error
  15.         set AppleScript's text item delimiters to oldDelimiters
  16.     end try
  17.     return theName
  18. end FindName
  19.  
  20. on open fileList -- This is necessary for drop-ability
  21.     
  22.     -- First thing: find my name: it's the receiver's name
  23.     set whoToSendTo to (FindName(path to me))
  24.     
  25.     tell application "Eudora1.4.2"
  26.         repeat with oneFile in fileList
  27.             -- I prefer to create a new mail message for each document because some mailers cannot
  28.             -- cope with multiple attachements (e.g. non-MIME-aware mailers)
  29.             set newMsg to make objectclass message inserthere end of mailbox "Out" of mail folder ""
  30.             set field "To:" of newMsg to whoToSendTo
  31.             
  32.             -- Find the name of the file; the "my" is necessary for Eudora not to interpret the
  33.             -- FindName procedure...
  34.             set oneFileName to my (FindName(oneFile))
  35.             set field "Subject:" of newMsg to oneFileName
  36.             
  37.             attach newMsg documentlist oneFile
  38.             queue newMsg queuetype 1
  39.             
  40.         end repeat
  41.         
  42.         with timeout of 3600 seconds -- 1 hour ought to do it!
  43.             connect with send and when idle without check -- Send the queued messages
  44.         end timeout
  45.         
  46.     end tell
  47. end open
  48.  
  49.